package com.cn.dao.impl;

import java.util.List;

import org.hibernate.Query;

import com.cn.dao.AccountDAO;

public class AccountDAOImpl extends  BaseHibernateDAOImpl implements AccountDAO{

	/**
	 * 根据account查找对象
	 * @param account
	 * @return
	 */
	public Object findByAccount(String account) {
		try {
			String queryString = "from Account as a where account = '" + account+"'";
			getSession().beginTransaction();
			Query queryObject = getSession().createQuery(queryString);
			List list = queryObject.list();
			getSession().getTransaction().commit();
			if (list.size() == 0) {
				return null;
			}
			return list.get(0);
		} catch (RuntimeException re) {
			throw re;
		}
	}
}
